package com.haixiaoke.saas.setSwitch.service.impl;

import java.util.List;
import com.haixiaoke.saas.common.utils.DateUtils;
import com.haixiaoke.saas.setSwitch.domain.SetSwitch;
import com.haixiaoke.saas.setSwitch.mapper.SetSwitchMapper;
import com.haixiaoke.saas.setSwitch.service.ISetSwitchService;
import com.haixiaoke.saas.system.framework.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;




/**
 * 订单审核状态Service业务层处理
 *
 * @author qixi
 * @date 2024-03-28
 */
@Service
public class SetSwitchServiceImpl implements ISetSwitchService {
    @Autowired
    private SetSwitchMapper setSwitchMapper;

    /**
     * 查询订单审核状态
     *
     * @param setSwitchId 订单审核状态主键
     * @return 订单审核状态
     */
    @Override
    public SetSwitch selectSetSwitchBySetSwitchId(Long setSwitchId) {
        return setSwitchMapper.selectSetSwitchBySetSwitchId(setSwitchId);
    }

    /**
     * 查询订单审核状态列表
     *
     * @param setSwitch 订单审核状态
     * @return 订单审核状态
     */
    @Override
    public List<SetSwitch> selectSetSwitchList(SetSwitch setSwitch) {
        return setSwitchMapper.selectSetSwitchList(setSwitch);
    }

    /**
     * 新增订单审核状态
     *
     * @param SetSwitch 订单审核状态
     * @return 结果
     */
    @Override
    public int insertSetSwitch(SetSwitch setSwitch) {
        return setSwitchMapper.insertSetSwitch(setSwitch);
    }

    @Override
    public int initializeSetSwitch(String tenantId) {
        SetSwitch setSwitch = SetSwitch.initialize();
        setSwitch.setTenantId(tenantId);
        return setSwitchMapper.insertSetSwitch(setSwitch);
    }

    /**
     * 修改订单审核状态
     *
     * @param setSwitch 订单审核状态
     * @return 结果
     */
    @Override
    public int updateSetSwitch(SetSwitch setSwitch) {
        setSwitch.setUpdateTime(DateUtils.getNowDate());
        setSwitch.setUpdateBy(SecurityUtils.getUserId().toString());
        return setSwitchMapper.updateSetSwitch(setSwitch);
    }

    /**
     * 批量删除订单审核状态
     *
     * @param setSwitchIds 需要删除的订单审核状态主键
     * @return 结果
     */
    @Override
    public int deleteSetSwitchBySetSwitchIds(Long[] setSwitchIds) {
        return setSwitchMapper.deleteSetSwitchBySetSwitchIds(setSwitchIds);
    }

    /**
     * 删除订单审核状态信息
     *
     * @param setSwitchId 订单审核状态主键
     * @return 结果
     */
    @Override
    public int deleteSetSwitchBySetSwitchId(Long setSwitchId) {
        return setSwitchMapper.deleteSetSwitchBySetSwitchId(setSwitchId);
    }

    @Override
    public SetSwitch selectSetSwitchByTenantId(String tenantId) {
        return setSwitchMapper.selectSetSwitchByTenantId(tenantId);
    }
}
